package com.pig4cloud.pigx.contract.api.feign;

import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
import com.pig4cloud.pigx.common.core.constant.ServiceNameConstants;
import com.pig4cloud.pigx.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import java.math.BigDecimal;

/**
 * 合约-仓位 feign接口
 *
 */
@FeignClient(contextId = "contractPositionFeign",
		value = ServiceNameConstants.CONTRACT_SERVICE,
		path = "/contract-position")
public interface ContractPositionFeign {

	/**
	 * 根据用户id查询
	 */
	String FLOAT_PROFIT_BY_USER = "/float-profit/by-user";

	/**
	 * 根据用户id 获取用户的未实现盈亏（USDT-精度2位）
	 *
	 * @param userId 用户id
	 * @return {@link R< BigDecimal>}
	 * @since 2022/9/13 22:20
	 */
	@PostMapping(FLOAT_PROFIT_BY_USER)
	R<BigDecimal> getFloatProfitByUser(@RequestBody Long userId, @RequestHeader(SecurityConstants.FROM) String from);
}
